package com.filter;

import java.io.IOException;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;

public class MyFilter1 implements Filter {

	public void init(FilterConfig filterConfig) throws ServletException {
		System.out.println("创建了MyFilter1过滤器");
	}

	public void doFilter(ServletRequest request, ServletResponse response,
			FilterChain chain) throws IOException, ServletException {
		//前置内容
		System.out.println("myfilter1拦截了请求");
		chain.doFilter(request, response) ;  //放行
		//后置内容
		System.out.println("myfilter1拦截了响应");
	}

	public void destroy() {
		System.out.println("销毁了MyFilter1过滤器");
	}

}
